<template>
  <div class="viewIntelligenPush">
    <div class="header-top">
      <div class="head-title" @click="gotoPage()">
        <i class="el-icon-back"></i>详情
      </div>
    </div>
    <div class="content-main">
      <div class="content-top">
        <div class="top-left">
          <div class="title">
            <span>推送1</span>
            <div class="type">已完成</div>
          </div>
          <div class="code-big">
            <div class="code-li">计划类型：<span>定时型-重复</span></div>
            <div class="code-li">推送时间：<span>每周日、一、二、三、四 04:00</span></div>
          </div>
          <div class="group-btn">
            <el-button plain size="small">暂停</el-button>
            <el-button plain size="small">编辑计划</el-button>
            <el-button plain size="small">取消</el-button>
          </div>
        </div>
        <div class="top-right">
          <ul>
            <li>
              <div class="code">完成目标</div>
              <div class="text">0</div>
            </li>
            <li>
              <div class="code">已触发用户</div>
              <div class="text">0</div>
            </li>
            <li>
              <div class="code">目标完成率</div>
              <div class="text"></div>
            </li>
          </ul>
        </div>

      </div>
      <div class="content-bottom">
        <ul class="tablist">
          <li :class="active==index?`active`:``" @click="getActive(index)" v-for="(item,index) in tablist">{{ item.label }}</li>
        </ul>
        <!--        数据详情-->
        <viewData v-if="active==0"></viewData>
        <!--        推送管理-->
        <pushMgt v-if="active==1"></pushMgt>
        <!--        计划配置-->
        <planConfiguration v-if="active==2"></planConfiguration>
        <!--        发送记录-->
        <sendingRecords v-if="active==3"></sendingRecords>
      </div>
    </div>


  </div>
</template>

<script>
export default {
  name: 'viewIntelligenPush',
  components: {
    'viewData': () => import('./viewData.vue'),
    'pushMgt': () => import('./pushMgt.vue'),
    'planConfiguration': () => import('./planConfiguration.vue'),
    'sendingRecords': () => import('./sendingRecords.vue'),
  },
  data() {
    return {
      active: 2,
      tablist: [
        {value: 0, label: '数据详情',},
        {value: 1, label: '推送管理',},
        {value: 2, label: '计划配置',},
        {value: 3, label: '发送记录',},
      ],
    }
  },
  created() {

  },
  mounted() {
  },
  watch: {},
  methods: {
    getActive(index) {
      this.active = index;
    },
    onSubmit(formName) {
      //提交的代码
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log('提交表单');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    gotoPage() {
      this.$router.push({
        path: '/IntelligentOperationMgt/IntelligentPush/IntelligentPushList',
        query: {
          urlActive: 0,
        }
      })
    },
    handleCloseDialog() {
      this.$emit('update:visableIf', false);
      this.$emit('handleQuery');
    }
  }
}
</script>

<style scoped lang="scss">

.content-main {

  padding: 12px;
  margin: 12px auto 12px auto;
  height: calc(100vh - 120px);
  overflow-y: auto;

}

.header-top {
  height: 46px;
  background: #fff;
  border-bottom: 1px solid #e9e9e9;
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 20px;
  position: relative;

  .head-title {
    font-size: 14px;
    line-height: 22px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    font-weight: bold;

    i {
      font-size: 20px;
      font-weight: bold;
      cursor: pointer;
      margin-right: 10px;
    }
  }

}

.footer-btn {
  position: absolute;
  left: 0px;
  right: 0px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.viewIntelligenPush {
  position: relative;
  padding-bottom: 50px;
}

.content-top {
  padding: 16px;
  border-radius: 4px;
  background: #fff;
  margin-left: 0 !important;
  margin-right: 0 !important;
  display: flex;

  .top-left {
    width: 50%;

    .title {
      font-size: 16px;
      color: rgba(0, 0, 0, .85);
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      font-weight: bold;

      .type {
        padding: 0px 10px;
        height: 36px;
        display: flex;
        align-items: center;
        font-size: 12px;
      }
    }

    .code-big {
      display: flex;
      align-items: center;
      font-size: 14px;
      color: rgba(0, 0, 0, .45);

      .code-li {
        margin-right: 20px;
      }

      span {
        color: rgba(0, 0, 0, .8);
      }
    }
  }

  .top-right {
    flex: 1;

    ul {
      display: flex;

      li {
        list-style: none;
        display: flex;
        flex: 1;
        margin: 0px 10px;
        height: 80px;
        background-color: #f5f5f5;
        padding: 12px 16px;
        border-radius: 4px;
        box-sizing: border-box;
        flex-direction: column;

        .text {
          font-weight: bold;
          margin-top: 10px;
        }
      }
    }
  }
}

.group-btn {
  margin-top: 10px;
}

.content-bottom {
  background: #fff;
  margin-top: 10px;
}

.tablist {
  font-size: 14px;
  margin-right: 10px;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #eee;

  li {
    cursor: pointer;
    font-weight: 400;
    list-style: none;
    margin: 0px 10px;
    position: relative;
    display: flex;
    height: 60px;
    align-items: center;
    font-size: 16px;
    font-weight: bold;

    &.active {
      color: #3070ff;

      &:after {
        content: '';
        position: absolute;
        height: 2px;
        background: #3070ff;
        width: 100%;
        bottom: 0px;
        left: 0px;
      }
    }
  }
}

</style>
